package org.lgiavedoni.android.franq.core.prediction.rule.dao;

import java.util.ArrayList;
import java.util.List;

import org.lgiavedoni.android.franq.core.dao.AbstractDAO;
import org.lgiavedoni.android.franq.core.prediction.rule.PredictionRule;

public class PredictionRuleDAO extends AbstractDAO<PredictionRule> {

	public static final PredictionRuleDAO inst = new PredictionRuleDAO();

	public void deleteAllNoValidatedForUser() {
		delete(getAllNoValidatedForUser());
	}

	public List<PredictionRule> getAllNoValidatedForUser() {
		List<PredictionRule> list = new ArrayList<PredictionRule>();
		for (PredictionRule pr : getAll()) {
			if (!pr.isValidateForUser()) {
				list.add(pr);
			}
		}
		return list;
	}

	public List<PredictionRule> getAllValidatedForUser() {
		List<PredictionRule> list = new ArrayList<PredictionRule>();
		for (PredictionRule pr : getAll()) {
			if (pr.isValidateForUser()) {
				list.add(pr);
			}
		}
		return list;
	}

	@Override
	public Class getObjectClass() {
		return PredictionRule.class;
	}

}
